package cn.iocoder.yudao.module.ao.dal.mysql.academicyear;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.academicyear.AcademicYearDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.academicyear.vo.*;

/**
 * 学年及班级信息 Mapper
 *
 * @author 智教云枢
 */
@Mapper
public interface AcademicYearMapper extends BaseMapperX<AcademicYearDO> {

    default PageResult<AcademicYearDO> selectPage(AcademicYearPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AcademicYearDO>()
                .eqIfPresent(AcademicYearDO::getSchoolId, reqVO.getSchoolId())
                .eqIfPresent(AcademicYearDO::getSchoolYear, reqVO.getSchoolYear())
                .likeIfPresent(AcademicYearDO::getTermName, reqVO.getTermName())
                .eqIfPresent(AcademicYearDO::getTermCode, reqVO.getTermCode())
                .betweenIfPresent(AcademicYearDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(AcademicYearDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(AcademicYearDO::getIsCurrent, reqVO.getIsCurrent())
                .eqIfPresent(AcademicYearDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(AcademicYearDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(AcademicYearDO::getYearId));
    }

}